
avalon.scan();

//路由定义
require(["mmRouter", "mmRequest"], function () {
    //首页，
    //监听路由
    avalon.router.get('/', function () {
        //调用门禁
        door.comeIn(openAccessDoing);
        layout.url="./package/home/home.html"
//        nav.Active(1)
        //加载所依赖的VM
        require(['home','list'], function () {
            //执行VM加载成功之后执行的页面变化
            home.ready()
            list.ready()
            avalon.scan()
        })
    });


    //编辑发布页面
    avalon.router.get('/edit/:id', function (id) {
        door.comeIn(seriousAccessDoing);
        require(['edit'],function(){
            edit.ready(id)
        })

        layout.url='./package/edit/edit.html'

    });

    //文章详情页面
    avalon.router.get('/art/:id',function(id){
        door.comeIn(openAccessDoing);
        layout.url='./package/art/art.html'
        require(['art'],function(){
            art.ready(id)

        })
        avalon.scan()
    })

    //用户界面
    avalon.router.get("/user/:id",function(id){
        door.comeIn(seriousAccessDoing);
        layout.url='./package/user/user.html'
        require(["user"],function(){
            user.ready(id)
        })
    })

    //后台管理界面
    avalon.router.get("/admin", function () {
        door.comeIn(seriousAccessDoing);
        layout.url='./package/admin/admin.html'
    })



    //开始监听
    avalon.history.start();
    //扫描
    avalon.scan();
});